Skip to content

Create coding1.java#1354

Open
Praniksha123 wants to merge 1 commit into
super30admin:masterfrom
Praniksha123:master
Open

Create coding1.java#1354
Praniksha123 wants to merge 1 commit into
super30admin:masterfrom
Praniksha123:master

Conversation

@Praniksha123

Copy link
Copy Markdown

completed

@super30admin

Copy link
Copy Markdown
Owner

Interview Problem: Find Missing Number in a sorted array (coding1.java)

Strengths:

  • Correctly implements binary search for the missing number problem
  • Excellent time and space complexity matching the reference solution
  • Clean, readable code with helpful comments
  • Proper handling of edge cases (array bounds with low+(high-low)/2 to prevent overflow)

Areas for Improvement:

  • The solution assumes the array contains consecutive integers starting from 1. Consider adding input validation for robustness.
  • The comment block could be more detailed, explaining why we check arr[mid] == mid+1.

VERDICT: NEEDS_IMPROVEMENT


Interview Problem: Design Min Heap

  • Strengths: The binary search implementation for the missing number problem appears correct and follows good practices (using low + (high - low) / 2 to avoid overflow, proper loop termination).
  • Critical Issue: You have solved a completely different problem. The assignment was to implement a Min Heap data structure with insert, extractMin, getMin, and heapify operations.
  • Next Steps: Please re-read the problem statement carefully. You need to:
    1. Create a MinHeap class with a heap array
    2. Implement parent, leftChild, rightChild helper methods
    3. Implement heapify for maintaining heap property
    4. Implement insert() to add elements while maintaining min-heap property
    5. Implement extractMin() to remove and return the minimum element
    6. Optionally implement getMin() and printHeap()

VERDICT: NEEDS_IMPROVEMENT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants